package com.xingfly.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.xingfly.dao.SeatDao;
import com.xingfly.model.dto.Seat;
import com.xingfly.service.SeatService;
@Service("seatService")
public class SeatServiceImpl implements SeatService{
	@Resource
	private SeatDao seatdao;
	/**
	 *查询全部座位状态为0的信息
	 */
	@Override
	public List<Seat> SelBySeatAll(int atstate) {
			List<Seat>selBySeatAll=null;
		try {
			selBySeatAll = seatdao.SelBySeatAll(atstate);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return selBySeatAll;
	}
	/**
	 * 更改坐位状态 1为0（占座）
	 */
	@Override
	public int UpdateByUid(int atstate, int seid) {
			int updateByUid=0;
		try {
			updateByUid = seatdao.UpdateByUid(atstate, seid);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return updateByUid;
	}
	/**
	 * 初始化所有坐位转态为0
	 */
	@Override
	public int UpdateByAllatstate() {
		int updateByAllatstate=0;
		try {
			updateByAllatstate = seatdao.UpdateByAllatstate();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return updateByAllatstate;
	}
}
